package cq.zhcqk.fragment._3_zw;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import cq.zhcqk.R;
import cq.zhcqk.activity.GzyyDetailActivity;

/**
 * Created by zhangle on 2017/12/10.
 */
public class _2_GzyyFragment extends Fragment implements View.OnClickListener{
    private View view;
    private TextView t_1;
    private TextView t_2;
    private TextView t_3;
    private TextView t_4;
    private TextView t_5;
    private TextView t_6;
    private TextView t_7;
    private TextView t_8;
    private TextView t_9;
    private Context context;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if(view==null){
            view = inflater.inflate(R.layout.fragment_3_2_gzyy, container, false);
            context = getActivity();
            initView();
        }
        ViewGroup parent=(ViewGroup)view.getParent();
        if(parent!=null){
            parent.removeView(view);
        }
        return view;
    }

    private void initView(){
        t_1 = (TextView) view.findViewById(R.id.t1);
        t_2 = (TextView) view.findViewById(R.id.t2);
        t_3 = (TextView) view.findViewById(R.id.t3);
        t_4 = (TextView) view.findViewById(R.id.t4);
        t_5 = (TextView) view.findViewById(R.id.t5);
        t_6 = (TextView) view.findViewById(R.id.t6);
        t_7 = (TextView) view.findViewById(R.id.t7);
        t_8 = (TextView) view.findViewById(R.id.t8);
        t_9 = (TextView) view.findViewById(R.id.t9);

        t_1.setOnClickListener(this);
        t_2.setOnClickListener(this);
        t_3.setOnClickListener(this);
        t_4.setOnClickListener(this);
        t_5.setOnClickListener(this);
        t_6.setOnClickListener(this);
        t_7.setOnClickListener(this);
        t_8.setOnClickListener(this);
        t_9.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()){
            case R.id.t1:
                intent = new Intent(context,GzyyDetailActivity.class);
                intent.putExtra("cid","131");
                intent.putExtra("id","1");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.t2:
                intent = new Intent(context,GzyyDetailActivity.class);
                intent.putExtra("cid","132");
                intent.putExtra("id","2");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.t3:
                intent = new Intent(context,GzyyDetailActivity.class);
                intent.putExtra("cid","133");
                intent.putExtra("id","3");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.t4:
                intent = new Intent(context,GzyyDetailActivity.class);
                intent.putExtra("cid","134");
                intent.putExtra("id","4");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.t5:
                intent = new Intent(context,GzyyDetailActivity.class);
                intent.putExtra("cid","135");
                intent.putExtra("id","5");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.t6:
                intent = new Intent(context,GzyyDetailActivity.class);
                intent.putExtra("cid","136");
                intent.putExtra("id","6");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.t7:
                intent = new Intent(context,GzyyDetailActivity.class);
                intent.putExtra("cid","137");
                intent.putExtra("id","7");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.t8:
                intent = new Intent(context,GzyyDetailActivity.class);
                intent.putExtra("cid","138");
                intent.putExtra("id","8");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.t9:
                intent = new Intent(context,GzyyDetailActivity.class);
                intent.putExtra("cid","139");
                intent.putExtra("id","9");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
        }
    }
}
